﻿<!--#include file="conn.asp"-->
<!--#include file="inc/CHAR.INC"-->
<%if request("act")="edit" then
ninfo="修改" 
else
ninfo="添加" 
end if
%>
<%set rs=server.createobject("adodb.recordset")
%><%if request("act")="全部删除" then
if request("id")="" then
response.write("<script>alert('错误:没有选定任何内容!');history.go(-1)</script>")
response.end
end if
conn.execute("delete from news where id in("&request("id")&")")
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
response.end
elseif request("act")="tj" then
conn.execute("update news set tj = ("&request("tj")&") where id in("&request("id")&")")
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
response.end

end if%>
<%if request("act")="save" then
id=request.form("id")
newtitle=request.form("newtitle")
newinfo=request.form("newinfo")
tj=request.form("tj")

if id="" then
sql="select * from news"
rs.open sql,conn,1,3
rs.addnew
else
sql="select * from news where id="&id
rs.open sql,conn,1,3
end if
rs("newtitle")=newtitle
rs("newinfo")=htmlencode2(trim(newinfo))
rs("tj")=tj
rs.update
rs.close
set rs=nothing 
response.write("<script>alert('成功："&ninfo&"网站公告成功!现在返回管理');location='gg_manage.asp'</script>")
response.end
end if%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="images/style.css" type="text/css" rel="stylesheet" />
    <meta content="MSHTML 6.00.3790.0" name="GENERATOR" />
</head>
<body>
    <%
if request("act")="edit" then
id=request("id")
set rs=server.createobject("adodb.recordset")
sql="select * from news where id="&id
rs.open sql,conn,1,1
newtitle=rs("newtitle")
newinfo=rs("newinfo")
tj=rs("tj")
end if
    %>
    <form name="form1" method="post" action="?act=save">
    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="3972B4">
            <td colspan="2" bgcolor="e7e7e7">
                <div align="center">
                    <strong><font color="#000000">
                        <%=ninfo%>网站公告</font></strong></div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="19%">
                <div align="right">
                    公告标题</div>
            </td>
            <td width="81%" bgcolor="#FFFFFF">
                <input name="newtitle" type="text" id="newtitle" value="<%=newtitle%>" size="40" /><input
                    name="id" type="hidden" id="id" value="<%=id%>" size="40" />
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="19%" bgcolor="#FFFFFF">
                <div align="right">
                    内容</div>
            </td>
            <td bgcolor="#FFFFFF">
                <textarea name="newinfo" cols="60" rows="20" id="newinfo"><%=htmlencode1(newinfo)%></textarea>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td colspan="2">
                <div align="center">
                    <input type="submit" name="Submit" class="Submit" value="确认<%=ninfo%>" />
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
<script language="JavaScript" type="text/JavaScript">
    function SwitchNewsType(NewsType) {
        switch (NewsType) {
            case "PicNews":
                document.getElementById('PicNews').style.display = '';
                break;
        }
    }
</script>
